package com.yt.common.utils;


import java.util.Arrays;
import java.util.List;

public class UtilConstants {

    public static final int ZERO = 0;

    public static final int ONE = 1;

    public static final int TWO = 2;

    public static final int THREE = 3;

    public static final int FOUR = 4;

    public static final int FIVE = 5;

    public static final int SIX = 6;

    public static final int SEVEN = 7;

    public static final int EIGHT = 8;

    public static final int NINE = 9;

    public static final int TEN = 10;

    public static final int ELEVEN = 11;

    public static final int TWELVE = 12;

    public static final int THIRTEEN = 13;

    public static final int FOURTEEN = 14;

    public static final String EVALUATION_TEXT = "东西质量非常好，与卖家描述的完全一致，非常满意,真的很喜欢，完全超出期望值，发货速度非常快，包装非常仔细、严实，物流公司服务态度很好，运送速度很快，很满意的一次购物。";

    public static final String CATEGORY_REDIS_KEY = "CATEGORY_REDIS_KEY";

    public static String getlinkNo() {
        StringBuilder linkNo = new StringBuilder();
        // 用字符数组的方式随机
        String model = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        char[] m = model.toCharArray();
        for (int j = 0; j < 6; j++) {
            char c = m[(int) (Math.random() * 36)];
            // 保证六位随机数之间没有重复的
            if (linkNo.toString().contains(String.valueOf(c))) {
                j--;
                continue;
            }
            linkNo.append(c);
        }
        return linkNo.toString();
    }

    /**
     * @Description: 判断集合是否为空
     * @Author: WangChenYu
     * @Param: [list]
     * @Date: 2020-10-16 23:49
     */
    public static boolean isNull(List list) {
        return null == list || list.isEmpty();
    }

    /**
     * @Description: ids排序
     * @Author: WangChenYu
     * @Param: [ids]
     * @Date: 2020-10-16 23:50
     */
    public static String getIds(String ids) {
        String[] split = ids.split(",");
        Arrays.sort(split);
        return String.join(",", split);
    }

}
